using System; 
using Server.Network; 

namespace Server.Misc 
{ 
   public class LoginUserCount
   { 
      public static void Initialize() 
      { 
         // Register event handler 
         EventSink.Login += new LoginEventHandler( EventSink_Login ); 
      } 

        private static void EventSink_Login( LoginEventArgs args ) 
        { 
            Mobile m = args.Mobile; 
            int userCount = NetState.Instances.Count;
            { 
                World.Broadcast( 0x35, true, "{0} has connected to the server. There {1} now currently {2} user{3} online.", args.Mobile.Name,
	            userCount == 1 ? "is" : "are",
	            userCount, userCount == 1 ? "" : "s" );
            } 
        } 
   } 

   public class LogoutUserCount
   { 
      public static void Initialize() 
      { 
         // Register event handler 
         EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected ); 
      } 
        private static void EventSink_Disconnected( DisconnectedEventArgs args ) 
        { 
            Mobile m = args.Mobile; 
            int userCount = NetState.Instances.Count;
            { 
                World.Broadcast( 0x35, true, "{0} has disconnected from the server. There {1} now currently {2} user{3} online.", args.Mobile.Name, 
	            userCount-1 == 1 ? "is" : "are",
	            userCount-1, userCount == 1 ? "" : "s" );
            } 
        } 
    } 
}